package edu.iscas.appcheckclient.service;


import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;

import java.util.HashMap;
import java.util.Map;

import edu.iscas.appcheckclient.model.Selector;

public class SpinnerNode {
    public AccessibilityNodeInfo accessibilityNodeInfo = null;
    public Selector selector = null;

    public AccessibilityEvent accessibilityEvent = null;
    public Map<AccessibilityNodeInfo, Selector> selectorMap = new HashMap<>();
    public boolean e = false;
    public boolean f = false;
    public int state = -1;

    public AccessibilityEvent getAccessibilityEvent() {
        return accessibilityEvent;
    }
    public AccessibilityNodeInfo getAccessibilityNodeInfo(){
        return this.accessibilityNodeInfo;
    }

    public void setAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
        this.accessibilityNodeInfo = accessibilityNodeInfo;
    }

    public void saveSelector(AccessibilityNodeInfo nodeInfo, Selector selector){
        if(!this.selectorMap.containsKey(nodeInfo)){
            this.selectorMap.put(nodeInfo, selector);
        }
    }

    public Selector getSelector(AccessibilityNodeInfo nodeInfo){
        return (Selector)this.selectorMap.get(nodeInfo);
    }

    public Selector getSelector(){
        return this.selector;
    }

    public void setSelector(Selector selector) {
        this.selector = selector;
    }

    public void setAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        this.accessibilityEvent = accessibilityEvent;
    }

    public void setState(int count) {
        this.state = count;
    }

    public void updateState(){this.state += 1;}

    public boolean isE() {
        return e;
    }

    public void setE(boolean e) {
        this.e = e;
    }

    public boolean isF() {
        return f;
    }

    public void setF(boolean f) {
        this.f = f;
    }
}
